package com.cx.common.core.dto.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import lombok.experimental.SuperBuilder;

import java.util.List;

/**
 * 分页请求结果
 *
 * @author _
 * @date 2020-08-24
 */
@ApiModel(description = "分页请求结果")
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageResp<T> extends BaseResp {

    private static final long serialVersionUID = 1L;

    /**
     * 分页数据
     */
    @ApiModelProperty(value = "分页数据")
    private List<T> data;

    /**
     * 总页数
     */
    @ApiModelProperty(value = "总页数", required = true, example = "0")
    private long totalPage;

    /**
     * 总条数
     */
    @ApiModelProperty(value = "总条数", required = true, example = "0")
    private long totalCount;

    /**
     * 是否有下一页
     */
    @ApiModelProperty(value = "是否有下一页", required = true, example = "false")
    private boolean hasNext;


    public PageResp<T> fileDomain(String fileDomain) {
        setFileDomain(fileDomain);
        return this;
    }
}
